import { request } from '@/utils/request.js'

/**
 * 附件 API JS
 */

export default {

  /**
   * 获取附件分页列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'document/attachment/index',
      method: 'get',
      params
    })
  },

  /**
   * 读取附件
   * @returns
   */
  read (id) {
    return request({
      url: 'document/attachment/read/' + id,
      method: 'get',
      data
    })
  },

  /**
   * 将附件删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'document/attachment/delete',
      method: 'delete',
      data
    })
  },

  /**
   * 更新附件数据
   * @returns
   */
  update (id, data = {}) {
    return request({
      url: 'document/attachment/update/' + id,
      method: 'put',
      data
    })
  },

  save (data = {}) {
    return request({
      url: 'document/attachment/save',
      method: 'post',
      data
    })
  },

  /**
   * 更改附件数据
   * @returns
   */
  changeStatus (data = {}) {
    return request({
      url: 'document/attachment/changeStatus',
      method: 'put',
      data
    })
  },

  /**
    * 附件导入
    * @returns
    */
  importExcel (data = {}) {
    return request({
      url: 'document/attachment/import',
      method: 'post',
      data
    })
  },
  remote (data = {}) {
    return request({
      url: 'document/attachment/remote',
      method: 'post',
      data
    })
  },

  /**
   * 附件下载模板
   * @returns
   */
  downloadTemplate () {
    return request({
      url: 'document/attachment/downloadTemplate',
      method: 'post',
      responseType: 'blob'
    })
  },


}